package com.ceshiren.chnjx.wework.page.contact.member;

import com.ceshiren.chnjx.wework.page.BasePage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

/**
 * @author: JJJJ
 * @date:2021/11/3 15:08
 * @Description: TODO
 */
public class MemberDetailPage extends BasePage {
    private By editMemberBtn = new By.ByLinkText("编辑");
    private By userNameLoc = new By.ByCssSelector(".member_display_cover_detail_name");
    private By nickNameLoc = new By.ByXPath("//*[contains(text(),'别名')]");
    private By accountLoc = new By.ByXPath("//*[contains(text(),'账号')]");;
    private By phoneLoc =  new By.ByLinkText("//div[text()='手机：']/following-sibling::div");

    public MemberDetailPage(WebDriver driver) {
        super(driver);
    }

    /**
     * 进入编辑成员页面
     */
    public AddOrEditMemberPage intoEditMemberPage(){
        clickElement(editMemberBtn);
        return new AddOrEditMemberPage(driver);
    }

    public String getName(){
        return getElementText(userNameLoc);
    }

    public String getNickName(){
        return getElementText(nickNameLoc);
    }

    public String getAccount(){
        return getElementText(accountLoc);
    }

    public String getPhone(){
        return getElementText(phoneLoc);
    }
}
